var t = getApp();

Page({
    data: {
        titleTop: [ "会员昵称", "本月", "本月", "本年度" ],
        titleButton: [ "ID", "订单数", "订单总额", "订单总额" ],
        slideDown: !1,
        selectedTime: "",
        currentDate: new Date().getTime(),
        minDate: new Date(2020, 0, 1).getTime(),
        currentTime: "",
        teamSalesList: []
    },
    onLoad: function(t) {},
    onReady: function() {},
    onShow: function() {
        this.setData({
            currentTime: this.timestampToTime(new Date().getTime())
        }), this.getData(this.data.currentTime);
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    changeSlideDown: function() {
        this.setData({
            slideDown: !this.data.slideDown
        });
    },
    timeToScreen: function(t) {
        var e = t.detail;
        this.setData({
            selectedTime: this.timestampToTime(e)
        }), this.getData(this.data.selectedTime), this.changeSlideDown();
    },
    cancelTimePopover: function() {
        this.setData({
            slideDown: !1
        });
    },
    formatter: function(t, e) {
        return "month" === t ? "".concat(e, "月") : "day" === t ? "".concat(e, "日") : e;
    },
    onInput: function(t) {
        this.setData({
            currentDate: t.detail
        });
    },
    timestampToTime: function(t) {
        var e = new Date(t);
        return e.getFullYear() + "-" + (e.getMonth() + 1 < 10 ? "0" + (e.getMonth() + 1) : e.getMonth() + 1);
    },
    getData: function(e) {
        var n = this;
        console.log(e), e = parseInt(e.replace("-", ""));
        var a = t.getNetAddresss("plugin.agent-earnings.frontend.sales-statistical.get-sales-detail");
        t._postNetWork({
            url: a,
            data: {
                month_str: e
            },
            success: function(t) {
                var e = t.data;
                1 == e.result ? n.setData({
                    teamSalesList: e.data.list.data
                }) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1e3
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    onShareAppMessage: function() {}
});